import Vue from 'vue'
import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import Element from 'element-ui'
import './styles/element-variables.scss'
import './styles/list-edit-page.scss'
// import enLang from 'element-ui/lib/locale/lang/en'

import '@/styles/index.scss' // global css
import App from './App'
import store from './store'
import router from './router'

import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log

import * as filters from './filters' // global filters
import PUBLIC from '@/utils/public'
import __ from './components/index'

import { MqttHelper } from '@/utils/mqttHelper'
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }
import _showDialog from './plugins/x2dialog/index'
Vue.use(_showDialog)

Vue.use(Element, { size: Cookies.get('size') || 'mini' })
Vue.use(PUBLIC, { ebus: new Vue() })

Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key])
})

try {
  window.M = new MqttHelper()
} catch (error) {
  console.log('mqtt 连接失败!', error)
}

Vue.config.productionTip = false
new Vue({
  el: '#app',
  router,
  store,
  render: (h) => h(App),
})

// import microApp from '@micro-zoe/micro-app'
// microApp.start()
